#include "shape.h"



void Rectangle::draw()
{
    std::cout << std::endl << __FUNCTION__<< std::endl;
}

void Circle::draw()
{
    std::cout << std::endl << __FUNCTION__<< std::endl;
}

ShapeDecorator::ShapeDecorator(Shape *pShape)
{
    m_decoratedShape = pShape;
}

void ShapeDecorator::draw()
{
    if (m_decoratedShape){
        m_decoratedShape->draw();
    }
}

RedShapeDecorator::RedShapeDecorator(Shape *pShape)
    :ShapeDecorator(pShape)
{
}

void RedShapeDecorator::draw()
{
    if (m_decoratedShape){
        m_decoratedShape->draw(); /// 先画本体
        setRedBorder(m_decoratedShape);  /// 添加附加属性
    }
}

void RedShapeDecorator::setRedBorder(Shape *decoratedShape)
{
    std::cout << "border: 1px solid red;"<< std::endl;
}
